window.onload = () => {
    document.querySelector("button")?.addEventListener("click", (event) => {
        event.preventDefault()

        const bedPerson: string[] = ['1', '2', '3', '4', '5', '6']

        // 必须使用 as HTMLInputElement 进行类型断言，否则 value 属性不会出现在 HTMLElement 类型上
        let number = (document.getElementById("number") as HTMLInputElement).value
        let bed = parseInt((document.getElementById("bed") as HTMLInputElement).value)

        if (number === "A") {
            if (1 <= bed && bed <= 6) {
                console.log("该同学姓名为：" + bedPerson[bed - 1])
            }else {
                console.log("输入错误 请选择1-6之间的数字")
            }
        }else {
            console.log("没有数据奥")
        }
    })
}